package com.course_design.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.course_design.dao.ClassMapper;
import com.course_design.entity.Class;
import com.course_design.entity.ClassExample;;

@Service
public class ClassService {
	@Autowired
	private ClassMapper classMapper;
	public List<Class> queryClassBySchoolId(Integer schoolId,Integer teacherId) {
		ClassExample example=new ClassExample();
		ClassExample.Criteria criteria =example.createCriteria();
		criteria.andSchoolEqualTo(schoolId);
		criteria.andCreatedteacherEqualTo(teacherId);
		List<Class> classes=classMapper.selectByExample(example);
		return classes;
	}
	public Integer addClass(Class class1) {
		classMapper.insert(class1);
		return class1.getClassid();
	}
	
}
